package org.androidpn.server.service.impl;

import org.androidpn.server.dao.ChatMsgDao;
import org.androidpn.server.model.ChatMessage;
import org.androidpn.server.service.ChatMsgNotFoundException;
import org.androidpn.server.service.ChatMsgService;

import java.util.List;

/**
 * Created by huang on 2017/4/20 0020.
 */
public class ChatMsgServiceImpl implements ChatMsgService{

    private ChatMsgDao chatMsgDao;

    public void setChatMsgDao(ChatMsgDao chatMsgDao) {
        this.chatMsgDao = chatMsgDao;
    }

    public void saveChatMessage(ChatMessage chatMessage) {
        chatMsgDao.saveChatMessage(chatMessage);
    }

    public List<ChatMessage> findChatMessageByToUser(String toUserId) {
        return chatMsgDao.findChatMessageByToUser(toUserId);
    }

    public void deleteChatMessage(ChatMessage chatMessage) {
        chatMsgDao.deleteChatMessage(chatMessage);
    }

    public void deleteChatMessageByUUID(String uuid) {
        chatMsgDao.deleteChatMessageByUUID(uuid);
    }

    public ChatMessage getChatMessageByUuid(String uuid) throws ChatMsgNotFoundException {
        return chatMsgDao.getChatMessageByUuid(uuid);
    }
}
